package com.xjcs.saplingplan.dialog

import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.ViewGroup
import android.view.Window
import com.airbnb.lottie.LottieAnimationView
import com.xjcs.saplingplan.R

class LoadingDialog(context: Context): Dialog(context) {

    init {
        requestWindowFeature(Window.FEATURE_NO_TITLE)
        setContentView(R.layout.pop_loading)
        window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
        setCancelable(false)
    }

    private fun createLoadingView(): LottieAnimationView{
        val lottieView = LottieAnimationView(context)
        val layoutParams = ViewGroup.LayoutParams(50, 50)
        lottieView.setAnimation("loading.json")
        lottieView.loop(true)
        lottieView.playAnimation()
        lottieView.layoutParams = layoutParams
        return lottieView
    }

}